import { Module } from "@nestjs/common";
import { JwtModule } from "@nestjs/jwt";
import { PassportModule } from "@nestjs/passport";
import { TypeOrmModule } from "@nestjs/typeorm";
import { RoleEntity } from "src/Entity/role.entity";
import { UsersEntity } from "src/Entity/user.entity";
import { UsersModule } from "../users.module";
import { AuthController } from "./auth.controller";
import { AuthService } from "./auth.service";
import { jwtConstants } from "./constants";
import { JwtStrategy } from "./jwt.strategy";
import { LocalStrategy } from "./local.strategy";


@Module({
    imports: [
      UsersModule,
      PassportModule,
      JwtModule.register({
        secret: jwtConstants.secret,
        signOptions: { expiresIn: '600s' },
      }),
      TypeOrmModule.forFeature([UsersEntity,RoleEntity]),
    ],
    providers: [AuthService, LocalStrategy,JwtStrategy],
    controllers:[AuthController],
    exports: [AuthService],
  })
  export class AuthModule {}